J=imread('manuscript.jpg');
figure,imshow(J,[]);
%clipping 1% of intensity values 
max = max(max(J));
min = min(min(J));
l= min + (0.01*(max-min));
h=max-(0.01*(max-min));
[M N]=size(J);
for x=1:M
    for y=1:N
        if( J(x,y) >=h)
            J(x,y)=255;
        end
            if (J(x,y) <= l)
                J(x,y)=0;
            end
    
    end
end
figure,imshow(J,[]);

%contrast stretching
I=imread('manuscript.jpg');
I2=im2double(I);
m=mean2(I2);
contrast=1./(1+(m./(I2+eps)).^5);
figure,imshow(contrast,[]);

